package org.darkforest.merchant.ajaxTemplete.impl;

import org.darkforest.enums.AjaxAlbumTypeEnum;
import org.darkforest.merchant.ajaxTemplete.AlbumAjaxPage;

/**
 * Created by valentina on 15/3/19.
 * 添加商品第二步商品手机详情相册返回code
 */
public class GoodsStep2MobileAlbum extends AlbumAjaxPageTemplete implements AlbumAjaxPage {

    public GoodsStep2MobileAlbum() {
        this.insertType = AjaxAlbumTypeEnum.MOBILE.getText();
    }

    @Override
    protected String getScriptCode() {

        String tpl = "";
        tpl += "<script type=\"text/javascript\">";
        tpl += "$(document).ready(function(){";

        tpl += " $('[nctype=\"mea_img\"]').find('a[class=\"demo\"]').click(function(){" +
                "    $('[nctype=\"mea_img\"]').load($(this).attr('href'));" +
                "    return false;" +
                "});" +
                "$('#jumpMenu_"+insertType+"').change(function(){" +
                "    $('[nctype=\"mea_img\"]').load('"+getAjaxUrl()+"&albumId=' + $(this).val());" +
                "});";

        tpl += "});" +
                "</script>";
        return tpl;
    }
}
